package org.juiceshop.groovy.orientdb;

import groovy.lang.Closure;

public class Utils {

	private Utils() {}
	
	
	public static <T> T callClosure (Closure<?> closure, T delegate, Object...args) {
		if (closure!=null) {
			Closure<?> clone = (Closure<?>)closure.clone();
			clone.setDelegate(delegate);
			clone.setResolveStrategy(Closure.DELEGATE_FIRST);
			clone.call(args);
		}
		return delegate;
	}
	
	
	
}
